import socket

def download_file(file_name):
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_address = ('10.43.133.92', 8888)
    client_socket.connect(server_address)

    client_socket.sendall(file_name.encode())

    data = client_socket.recv(1024)
    if data == b'File not found':
        print('文件未找到')
    else:
        with open('downloaded_' + file_name, 'wb') as file:
            file.write(data)

    client_socket.close()

if __name__ == '__main__':
    file_name = 'readerme.md'  # 要下载的文件
    if file_name:
        download_file(file_name)
        print('文件已下载')

    else:
        print('下载失败')
    